UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AP/woATPSqc6/3eZHJHCdM0ikgM9uTexgh/Lq+Fxdog=' 
WHERE 
  key_id = '36b7ba150706d7edc14877ed51ef114c5c92f540a1de3160c18d7f07d31809c3' 
  AND (
    token = 'AP/woATPSqc6/3eZHJHCdM0ikgM9uTexgh/Lq+Fxdog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021