UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TmXm7xMdXr1TkzRPtIshT6ihTLN6osRLMljldRlsxJU=' 
WHERE 
  key_id = '4ca62e7990ef8a37a0f4cdbf7639266fa4a61ab924fc1d358f21fc2f7d38eeb2' 
  AND (
    token = 'TmXm7xMdXr1TkzRPtIshT6ihTLN6osRLMljldRlsxJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023