UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Ne/5NvhR0x49k800aTOqkAXBMs6BckPsKC9ahB+e64=' 
WHERE 
  key_id = 'f502cfec29b1949502d99a222a5a7b7b4c4d965a019b376158acacea405fc6f6' 
  AND (
    token = '2Ne/5NvhR0x49k800aTOqkAXBMs6BckPsKC9ahB+e64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035