UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bt1i1OcVfrZmJf/OPeD6R2/+DdO7637ST6owGvyeLKQ=' 
WHERE 
  key_id = 'e10b5cff0d3899d18d562b499d15f2b5495be7dcf4182445a3f961c41a4bd065' 
  AND (
    token = 'Bt1i1OcVfrZmJf/OPeD6R2/+DdO7637ST6owGvyeLKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039