UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bKHW71Wnq1tt4/qsbUpbK2Vfo3h98zIyO64H/0PwE2s=' 
WHERE 
  key_id = '39120b3751999cffbf671f8ef92ef78ea7edf0c70402258c73a46b9a91854d07' 
  AND (
    token = 'bKHW71Wnq1tt4/qsbUpbK2Vfo3h98zIyO64H/0PwE2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033