UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C4TV8dNX6vjq6yWg1YS0XcgRIcNTrXyhtmwWQHN2Ong=' 
WHERE 
  key_id = '6be46fac9c9760289690e44cbfd1d98dec8e9c1669c4456aa2534d42750ff08e' 
  AND (
    token = 'C4TV8dNX6vjq6yWg1YS0XcgRIcNTrXyhtmwWQHN2Ong=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033