UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XtsirHewE1mBa12OLVdWsUI3/RtMHqKfTGBpcveHDo4=' 
WHERE 
  key_id = '4a6ac6c837c9ffac8398f5fe533dce8814e13e6c4b1bbc7f9bbc75cf85079e66' 
  AND (
    token = 'XtsirHewE1mBa12OLVdWsUI3/RtMHqKfTGBpcveHDo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040