UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TyfRQ23wJmp7xkkA440Jwx2bpS9ZPeQBbwATU31xc1I=' 
WHERE 
  key_id = 'a4f50b63c8f5668073a4c869c21aefa1afa13d505c0aee1bbc35e777f94553d9' 
  AND (
    token = 'TyfRQ23wJmp7xkkA440Jwx2bpS9ZPeQBbwATU31xc1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032