UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YvhzPx3cSl7KkspKvWHQXXI6a7efrYcwNNfL2Kw/wBo=' 
WHERE 
  key_id = 'a2b038e4822baa2c5f72796b9e2451c630332879151d9e8e33f575b49dcaa787' 
  AND (
    token = 'YvhzPx3cSl7KkspKvWHQXXI6a7efrYcwNNfL2Kw/wBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031