UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6FxtuyEQsn76gnqWjrtEmCDhdgYoZWUNqrGOyOrEYoA=' 
WHERE 
  key_id = '46c27863613e34076c9c6733a0085b791b3194a360ca0e45323467fc83c2edee' 
  AND (
    token = '6FxtuyEQsn76gnqWjrtEmCDhdgYoZWUNqrGOyOrEYoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018