UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KW3Q+8CezT1Mxy34+QddeIxDILVtNKnusQi/rUXFZQY=' 
WHERE 
  key_id = '0ef2869c3d5e505214182f862cdbe428b3eb1a86070e18374736c1e37a7b5055' 
  AND (
    token = 'KW3Q+8CezT1Mxy34+QddeIxDILVtNKnusQi/rUXFZQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024