UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qyfUT4s/T099TSP5McWg00n0jn/0COS8Xq+cjvLfk7Q=' 
WHERE 
  key_id = '57a327f9314d29952b88158077c88ed990d1ecf3197243fa8724c58a64b866aa' 
  AND (
    token = 'qyfUT4s/T099TSP5McWg00n0jn/0COS8Xq+cjvLfk7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048