UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rRULU1+uPWT0dmvZW0Q5nWZTDoKgHLiiL5xYXopuIAk=' 
WHERE 
  key_id = '4329c9b304c316be7359fec94ee49a55fa4386a2a87c8e5eec318b63dd796063' 
  AND (
    token = 'rRULU1+uPWT0dmvZW0Q5nWZTDoKgHLiiL5xYXopuIAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035