UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cnnbChr018i+a1pz6tfob1sc82Lohi5jcSQEt8Kbv7c=' 
WHERE 
  key_id = 'b510bf64f86edeb51c7fa7182528eae6f0b557c75aeb6223951a6b856d11e958' 
  AND (
    token = 'cnnbChr018i+a1pz6tfob1sc82Lohi5jcSQEt8Kbv7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029