UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A52FjvvKWe6FTrFt8KrsjLhUg8lgawCSVwZrAZoiX90=' 
WHERE 
  key_id = '67e885b52eb24d055e3bbb6e4d05b4339d25acdc9858e01de7303c717a94136f' 
  AND (
    token = 'A52FjvvKWe6FTrFt8KrsjLhUg8lgawCSVwZrAZoiX90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028