UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5dlsrgO9mn33OhK10mCdUdfzcl5QHRLAGLwzUJc2YKk=' 
WHERE 
  key_id = '83bd0e4620af43df708d5f47f07b8374e4911d703182619a060ee7aa12abfded' 
  AND (
    token = '5dlsrgO9mn33OhK10mCdUdfzcl5QHRLAGLwzUJc2YKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026