UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n/aFGCPCn4+wxv3DnEfFZwMkJnP/enWOQ599UH0N2ac=' 
WHERE 
  key_id = '6439a49e2a2c1865e35f66228382025257cf842acdb00f821969a8a5c05141b6' 
  AND (
    token = 'n/aFGCPCn4+wxv3DnEfFZwMkJnP/enWOQ599UH0N2ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038