UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bLZheAcJxpGs2auRcrdnMC4q8WUzpkiKziTNX849y9g=' 
WHERE 
  key_id = '4eace86f858d19ec95f885245442be00b708521f86d6e054728351a5fbfd8aee' 
  AND (
    token = 'bLZheAcJxpGs2auRcrdnMC4q8WUzpkiKziTNX849y9g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047