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

Query time 0.00045