UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kahBk+f3XtEWWudxa/7mWDi/zA/pgA+uHlc74X1NIOg=' 
WHERE 
  key_id = '2da1d12b6fdcad5ef90bc58143ffac55054b021cfe4b507617173728c85b317f' 
  AND (
    token = 'kahBk+f3XtEWWudxa/7mWDi/zA/pgA+uHlc74X1NIOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028