UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YDD33xKmnzUrILi6LLrn02LHOncDaDIFQEemGOoEO00=' 
WHERE 
  key_id = '29ba46bcb35b421b46a243a2f378a1c0c82a03809c41bb586b187f14ce485b30' 
  AND (
    token = 'YDD33xKmnzUrILi6LLrn02LHOncDaDIFQEemGOoEO00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032