UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grKqJTkO14uUhgBD9aAKfGAqTyIO4ZJDNIj554Ul/Ko=' 
WHERE 
  key_id = '6508904593307a1b0b162c52f1e6fa8786969de0c8db14d288bee8094530cc9d' 
  AND (
    token = 'grKqJTkO14uUhgBD9aAKfGAqTyIO4ZJDNIj554Ul/Ko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022