UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u+E9zPph8U/QGCBJOvt/wXTgVNKdJ8i6V9fICbhPFrM=' 
WHERE 
  key_id = '935cbcd7412a68c113cc1085f05febe8f9e75ea33bfb3002d022c09b4214d9d6' 
  AND (
    token = 'u+E9zPph8U/QGCBJOvt/wXTgVNKdJ8i6V9fICbhPFrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059