UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oOpvm/FCz12FjKKtF9hFoDj0mRIKgf9e12JE5heGrH4=' 
WHERE 
  key_id = '9f59184b91f6591e05842a0e55476194435e7e378ee856ee6c94afa48e02a0d4' 
  AND (
    token = 'oOpvm/FCz12FjKKtF9hFoDj0mRIKgf9e12JE5heGrH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034