UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qbWJWIqXukDMOhpQMjayW1Y8UfiFyXf0KrB9VlY+/L4=' 
WHERE 
  key_id = '1b2c3a1fa24284a78f8a73e73b675f610374880e9b1da05b32bd129ebfb50bf1' 
  AND (
    token = 'qbWJWIqXukDMOhpQMjayW1Y8UfiFyXf0KrB9VlY+/L4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037