UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2ykOW9GysDdlu0u11agFs4Mje76t+1GhqWXMt9xsyz8=' 
WHERE 
  key_id = '977152527023e39e73d68c2567a5a2c21374930f4c0d29a755fbe1ffdb025adf' 
  AND (
    token = '2ykOW9GysDdlu0u11agFs4Mje76t+1GhqWXMt9xsyz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035