UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '02rvNmZLhGnJOAL3YDsh0C1s0evGV5XsVaWEOUv6stM=' 
WHERE 
  key_id = 'c270fcc79b45817fd6786b9716311d3396c574521d5944514b8b4bb99f6f00e1' 
  AND (
    token = '02rvNmZLhGnJOAL3YDsh0C1s0evGV5XsVaWEOUv6stM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043