UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iXj47IC7TwPONfYtvGcpfgBrrWQhw+2n45S7X5eRWGQ=' 
WHERE 
  key_id = 'b22c0aafb1815e729777af62face22cff92fd66e4149b5ad98422096cb72ac30' 
  AND (
    token = 'iXj47IC7TwPONfYtvGcpfgBrrWQhw+2n45S7X5eRWGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039