UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gSW5FuXcAszJht6l3IuUUM4p3VzIzQ76Wim1whsol/Y=' 
WHERE 
  key_id = '6993b1a24168a2ef44588c6d36a24edf3e0441935202ff4323afbd94086745e1' 
  AND (
    token = 'gSW5FuXcAszJht6l3IuUUM4p3VzIzQ76Wim1whsol/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033