UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hOGHhJYg+5goC6ALcpdTL7m5SfHI5Ki6arO1Iefe19M=' 
WHERE 
  key_id = '4e3317aef9cf1bfe35614620391ddb3631a49949c36e2b483fe80f10ebc1baa1' 
  AND (
    token = 'hOGHhJYg+5goC6ALcpdTL7m5SfHI5Ki6arO1Iefe19M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041