UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd8TO5P6HPRwDwAzPBngbUqKSW9QdCS83jFJpWF76dU0=' 
WHERE 
  key_id = '5cf97f07ad0b447cec5b494e0f814ee09edf3dc439ca5840615e188b57a6e46d' 
  AND (
    token = 'd8TO5P6HPRwDwAzPBngbUqKSW9QdCS83jFJpWF76dU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030