UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OiQv4SCtJq/xot0pcX1v39XQLKkgrE0eUungcn7Sni4=' 
WHERE 
  key_id = 'b99d726e280688a912422a12df24c307009ec74881afecb9ab98ea6140267679' 
  AND (
    token = 'OiQv4SCtJq/xot0pcX1v39XQLKkgrE0eUungcn7Sni4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024