UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jMNjls70y8dKXdpfNNoj1+8eC31wu2bN1ZzQqGjNL+A=' 
WHERE 
  key_id = '5d2693f73522726e58525a91f272f863e156544ac17933db0cb37545ad11ba31' 
  AND (
    token = 'jMNjls70y8dKXdpfNNoj1+8eC31wu2bN1ZzQqGjNL+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049