UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fxdnqY8I8KWH4Nzg/mRJxqNG0LECOe/LHvXZsNy4Gmc=' 
WHERE 
  key_id = 'd1ab8c9f9c93613f0bece1184794ee676012c63facd79c08799af43cddfff734' 
  AND (
    token = 'fxdnqY8I8KWH4Nzg/mRJxqNG0LECOe/LHvXZsNy4Gmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032