UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H149FkQnHGd5bHFWvqWf23YyuUVUvkOTv7kr2BWdewc=' 
WHERE 
  key_id = '345d5f4e91d76df1d708e23e59d2b9a29a8eda2a270c33d5ed0b7f5641bda570' 
  AND (
    token = 'H149FkQnHGd5bHFWvqWf23YyuUVUvkOTv7kr2BWdewc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046