UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YEDSmOFtX0g8BvGepKBd9pq7MQfFbfPyxYC2mCOkQzU=' 
WHERE 
  key_id = '4331fea48b8396e949056d6c63dce7f4c5049ded0ffac40c66f0b768dc995202' 
  AND (
    token = 'YEDSmOFtX0g8BvGepKBd9pq7MQfFbfPyxYC2mCOkQzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053