UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RC71bYEoubiob2WS11cnixwq4VCcGQr9C/8MtfdXlhw=' 
WHERE 
  key_id = '651b96117de5f0d1c99c0e689026e06858e1923b565f68fc9907f9809dcabdbf' 
  AND (
    token = 'RC71bYEoubiob2WS11cnixwq4VCcGQr9C/8MtfdXlhw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066