UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yikYPkcIO7aksTDzue09MzWfEQrre4G0rWo5vBIGcrc=' 
WHERE 
  key_id = 'c16a5e2ddc4d88fc93f60c12b531c7263cb530956830e565dbd4c57ed5f69d6c' 
  AND (
    token = 'yikYPkcIO7aksTDzue09MzWfEQrre4G0rWo5vBIGcrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032