UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rqL4tdj493SpH0V+JZhFFz5MBNnZGDozeaTjCxPRoBk=' 
WHERE 
  key_id = 'e57aedd52b606e7885f0264a0fef7ec7a8b56abe5483f87f3be74c16486e07da' 
  AND (
    token = 'rqL4tdj493SpH0V+JZhFFz5MBNnZGDozeaTjCxPRoBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025